package cn.gs;


import cn.gs.entity.User;
import cn.gs.service.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

/**
 * 基于Java配置的Bean
 * 1.配置类
 * 2.配置类中定义Bean
 * 3.配置类中定义Aspect ？
 * **/
public class Application {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext("cn.gs");

        UserServiceImpl userService = context.getBean(UserServiceImpl.class);

        List<User> userList = userService.findUserList();

        // print info from beans
        userList.forEach(a -> System.out.println("启动类非配置类"+a.getName() + "," + a.getAge() + "," + a.getRemark()));

    }
}
